#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int dominantIndex(int* nums, int numsSize)
{
    int i = 0;
    int max1 = 0;
    int max2 = 0;
    int count = 0;
    for (i = 0; i < numsSize; i++)
    {
        if (nums[i] > max1)
        {
            max2 = max1;
            max1 = nums[i];
            count = i;
        }
        else if (nums[i] > max2)
        {
            max2 = nums[i];
        }

    }
    return max1 >= max2 * 2 ? count : -1;
}
int main()
{
    int arr[5] = { 0, 6, 2, 12, 5 };
    int len = sizeof(arr) / sizeof(arr[1]);
    int ret = dominantIndex(arr, len);
    printf("%d", ret);
	return 0;
}